package com.home.jinlanhua.result;

import java.io.Serializable;

/**
 * 只带有一个属性的
 **/
public class Result<T>  implements Serializable {
    private T data;
    private int code;
    private String message;

    public static Result error(int i, String string) {
        Result<String> objectResult = new Result<>();
        objectResult.code = i;
        objectResult.message = string;
        return objectResult;
    }

    public static Result success(String string,Object value) {
        Result<Object> objectResult = new Result<>();
        objectResult.code = 1;
        objectResult.message = string;
        objectResult.data = value;
        return objectResult;
    }

    public Result<T> setData(T value) {
        this.data = value;
        return this;
    }

    public T getData() {
        return data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
